// components/benefitCardPopup/benefitCardPopup.js
import {requestSubscribeMessage} from "../../utils/wxapi";
import {isShowReminderOfExpired} from "../../utils/publicMethods";
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        benefitCardPopupImg:{
            type: String,
            value: ''
        },
        money:{
            type: String,
            value: ''
        },
        isPage:{
            type: String,
            value: ""
        }
    },

    /**
     * 组件的初始数据
     */
    data: {
        imagesUrl: getApp().globalData.imagesUrl,
        show:false,
        prizeData:"",
        isxyr:false,
        entryMode:''
    },

    /**
     * 组件的方法列表
     */
    methods: {
        async close(){
            let flag = await isShowReminderOfExpired(this.data.prizeData.prizeOrderId);
            if(flag){
                requestSubscribeMessage(this.data.prizeData.prizeOrderId);
            }
            this.setData({
                show:!this.data.show
            })
            if(this.data.isxyr){
                this.isxyr()
            }
        },
        isxyr(){
            this.triggerEvent('showPrize');
        },
        //权益卡跳转详情页
        benefitCardDetails(e){
            this.close();
            wx.navigateTo({
                url: '/pages/commonPage/benefitCardDetails/benefitCardDetails?entryMode='+this.data.entryMode+'&prizeOrderId='+this.data.prizeData.prizeOrderId
            })
        }
    }
})
